#include <iostream>
#include "TaskQueue.h"
#include "Producer.h"
#include "Consumer.h"
#include <thread>

using namespace std;

int main()
{
    TaskQueue taskQueue(10);

    Producer pro;
    Consumer con;

    thread thpro(&Producer::produce,&pro,ref(taskQueue));
    thread thpro2(&Producer::produce,&pro,ref(taskQueue));
    thread thpro3(&Producer::produce,&pro,ref(taskQueue));
    
    thread thcon(&Consumer::consume,&con,ref(taskQueue));
    thread thcon2(&Consumer::consume,&con,ref(taskQueue));
    thread thcon3(&Consumer::consume,&con,ref(taskQueue));

    thpro.join();
    thpro2.join();
    thpro3.join();
    
    thcon.join();
    thcon2.join();
    thcon3.join();

    return 0;
}

